package Scanner;

import java.io.*;
public class fileopenclose
{	
	public String  file_open( File filename)throws IOException
	{
	 try{
		String filestring="";//int c=1;
		BufferedReader br= new BufferedReader(new FileReader(filename));
		String str="";
		while((str=br.readLine())!=null)filestring=filestring+str+"\n";
			 
			br.close();
			return filestring;
	    } 
	 catch(Exception e)
	 {
		 System.out.println("error!");
		 return null;
	 }
	 
	  
	}
 
	public  void file_close(File filename, String filetext)throws IOException
	{
	 try{
		BufferedWriter bw=new BufferedWriter(new FileWriter(filename));
		bw.write(filetext,0,filetext.length());
		bw.close();
	     } 
	 catch(Exception e)
	 {
		 System.out.println("save error!");
	 }
	
	}
}